<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>miniFOC: hardware/timer.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Acme_LOGO.png"/></td>
  <td id="projectalign">
   <div id="projectname">miniFOC<span id="projectnumber">&#160;1.0.3</span>
   </div>
   <div id="projectbrief">This open-source project aims to accomplish a FOC(Field Oriented Control) scheme that is operatable with minimum costs in China.</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_42e555215cde261dd5295a864caa3e52.html">hardware</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle"><div class="title">timer.h File Reference</div></div>
</div><!--header-->
<div class="contents">

<p>this is the header file of <a class="el" href="timer_8c.html" title="this file contains the code implementation of timer initialization and disable timer function and set...">timer.c</a>.  
<a href="#details">More...</a></p>

<p><a href="timer_8h_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="define-members" name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:aacaca0988244bd3a888ca5befa89f44b"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#aacaca0988244bd3a888ca5befa89f44b">PWM_PERIOD</a>&#160;&#160;&#160;18000 / <a class="el" href="config_8h.html#a6177eb86ee16a1956c81749e4e332cf0">PWM_FREQUENCY</a></td></tr>
<tr class="memdesc:aacaca0988244bd3a888ca5befa89f44b"><td class="mdescLeft">&#160;</td><td class="mdescRight">PWM period calculate from PWM_FREQUENCY.  <a href="timer_8h.html#aacaca0988244bd3a888ca5befa89f44b">More...</a><br /></td></tr>
<tr class="separator:aacaca0988244bd3a888ca5befa89f44b"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ab3614c1dcfba485b2e299839d9c189e4"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#ab3614c1dcfba485b2e299839d9c189e4">update_pwm_dutycycle</a> (float ch0, float ch1, float ch2)</td></tr>
<tr class="memdesc:ab3614c1dcfba485b2e299839d9c189e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">update timer1 ch0 1 2 duty-cycle  <a href="timer_8h.html#ab3614c1dcfba485b2e299839d9c189e4">More...</a><br /></td></tr>
<tr class="separator:ab3614c1dcfba485b2e299839d9c189e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0ff329af778ba1ea50c17d3184af78d5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#a0ff329af778ba1ea50c17d3184af78d5">timer2_disable</a> (void)</td></tr>
<tr class="memdesc:a0ff329af778ba1ea50c17d3184af78d5"><td class="mdescLeft">&#160;</td><td class="mdescRight">disable timer2 periph and timer2 interrupt  <a href="timer_8h.html#a0ff329af778ba1ea50c17d3184af78d5">More...</a><br /></td></tr>
<tr class="separator:a0ff329af778ba1ea50c17d3184af78d5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a96e7b337ea7bf3c245ff1053e4843a1d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#a96e7b337ea7bf3c245ff1053e4843a1d">timer13_disable</a> (void)</td></tr>
<tr class="memdesc:a96e7b337ea7bf3c245ff1053e4843a1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">disable timer13 periph and timer2 interrupt  <a href="timer_8h.html#a96e7b337ea7bf3c245ff1053e4843a1d">More...</a><br /></td></tr>
<tr class="separator:a96e7b337ea7bf3c245ff1053e4843a1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af7559b2302c6fd04f459ae08a2eb8f6d"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#af7559b2302c6fd04f459ae08a2eb8f6d">timer2_config</a> (void)</td></tr>
<tr class="memdesc:af7559b2302c6fd04f459ae08a2eb8f6d"><td class="mdescLeft">&#160;</td><td class="mdescRight">configure timer2 periph for timing interrupt  <a href="timer_8h.html#af7559b2302c6fd04f459ae08a2eb8f6d">More...</a><br /></td></tr>
<tr class="separator:af7559b2302c6fd04f459ae08a2eb8f6d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97f6f408a34a56cfe1488f8aafa54756"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#a97f6f408a34a56cfe1488f8aafa54756">timer13_config</a> (void)</td></tr>
<tr class="memdesc:a97f6f408a34a56cfe1488f8aafa54756"><td class="mdescLeft">&#160;</td><td class="mdescRight">configure timer13 periph for timing interrupt  <a href="timer_8h.html#a97f6f408a34a56cfe1488f8aafa54756">More...</a><br /></td></tr>
<tr class="separator:a97f6f408a34a56cfe1488f8aafa54756"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5047a45bb0e8e868a84cbe6c6d5f8ec8"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="timer_8h.html#a5047a45bb0e8e868a84cbe6c6d5f8ec8">pwm_config</a> (void)</td></tr>
<tr class="memdesc:a5047a45bb0e8e868a84cbe6c6d5f8ec8"><td class="mdescLeft">&#160;</td><td class="mdescRight">configure timer1 periph and its gpios  <a href="timer_8h.html#a5047a45bb0e8e868a84cbe6c6d5f8ec8">More...</a><br /></td></tr>
<tr class="separator:a5047a45bb0e8e868a84cbe6c6d5f8ec8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >this is the header file of <a class="el" href="timer_8c.html" title="this file contains the code implementation of timer initialization and disable timer function and set...">timer.c</a>. </p>
<dl class="section author"><dt>Author</dt><dd>Lao·Zhu </dd></dl>
<dl class="section version"><dt>Version</dt><dd>V1.0.1 </dd></dl>
<dl class="section date"><dt>Date</dt><dd>10. October 2021 </dd></dl>

<p class="definition">Definition in file <a class="el" href="timer_8h_source.html">timer.h</a>.</p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="aacaca0988244bd3a888ca5befa89f44b" name="aacaca0988244bd3a888ca5befa89f44b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aacaca0988244bd3a888ca5befa89f44b">&#9670;&nbsp;</a></span>PWM_PERIOD</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define PWM_PERIOD&#160;&#160;&#160;18000 / <a class="el" href="config_8h.html#a6177eb86ee16a1956c81749e4e332cf0">PWM_FREQUENCY</a></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>PWM period calculate from PWM_FREQUENCY. </p>

<p class="definition">Definition at line <a class="el" href="timer_8h_source.html#l00015">15</a> of file <a class="el" href="timer_8h_source.html">timer.h</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a5047a45bb0e8e868a84cbe6c6d5f8ec8" name="a5047a45bb0e8e868a84cbe6c6d5f8ec8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5047a45bb0e8e868a84cbe6c6d5f8ec8">&#9670;&nbsp;</a></span>pwm_config()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void pwm_config </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>configure timer1 periph and its gpios </p>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00117">117</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">References <a class="el" href="timer_8h_source.html#l00015">PWM_PERIOD</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="a97f6f408a34a56cfe1488f8aafa54756" name="a97f6f408a34a56cfe1488f8aafa54756"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a97f6f408a34a56cfe1488f8aafa54756">&#9670;&nbsp;</a></span>timer13_config()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void timer13_config </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>configure timer13 periph for timing interrupt </p>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00089">89</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">References <a class="el" href="config_8h_source.html#l00030">TIM13_FREQUENCY</a>, and <a class="el" href="config_8h_source.html#l00041">TIM13_PRIORITY</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="a96e7b337ea7bf3c245ff1053e4843a1d" name="a96e7b337ea7bf3c245ff1053e4843a1d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a96e7b337ea7bf3c245ff1053e4843a1d">&#9670;&nbsp;</a></span>timer13_disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void timer13_disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>disable timer13 periph and timer2 interrupt </p>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00030">30</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="af7559b2302c6fd04f459ae08a2eb8f6d" name="af7559b2302c6fd04f459ae08a2eb8f6d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af7559b2302c6fd04f459ae08a2eb8f6d">&#9670;&nbsp;</a></span>timer2_config()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void timer2_config </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>configure timer2 periph for timing interrupt </p>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00061">61</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">References <a class="el" href="config_8h_source.html#l00028">TIM2_FREQUENCY</a>, and <a class="el" href="config_8h_source.html#l00039">TIM2_PRIORITY</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="a0ff329af778ba1ea50c17d3184af78d5" name="a0ff329af778ba1ea50c17d3184af78d5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0ff329af778ba1ea50c17d3184af78d5">&#9670;&nbsp;</a></span>timer2_disable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void timer2_disable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>disable timer2 periph and timer2 interrupt </p>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00044">44</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">References <a class="el" href="timer_8c_source.html#l00020">update_pwm_dutycycle()</a>.</p>

<p class="reference">Referenced by <a class="el" href="main_8c_source.html#l00139">main()</a>.</p>

</div>
</div>
<a id="ab3614c1dcfba485b2e299839d9c189e4" name="ab3614c1dcfba485b2e299839d9c189e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3614c1dcfba485b2e299839d9c189e4">&#9670;&nbsp;</a></span>update_pwm_dutycycle()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void update_pwm_dutycycle </td>
          <td>(</td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>ch0</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>ch1</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">float&#160;</td>
          <td class="paramname"><em>ch2</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>update timer1 ch0 1 2 duty-cycle </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramdir">[in]</td><td class="paramname">ch0</td><td>duty-cycle of channel0, 0 ~ 1.0f </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ch1</td><td>duty-cycle of channel1, 0 ~ 1.0f </td></tr>
    <tr><td class="paramdir">[in]</td><td class="paramname">ch2</td><td>duty-cycle of channel2, 0 ~ 1.0f </td></tr>
  </table>
  </dd>
</dl>

<p class="definition">Definition at line <a class="el" href="timer_8c_source.html#l00020">20</a> of file <a class="el" href="timer_8c_source.html">timer.c</a>.</p>

<p class="reference">References <a class="el" href="timer_8h_source.html#l00015">PWM_PERIOD</a>.</p>

<p class="reference">Referenced by <a class="el" href="encoder_8c_source.html#l00119">encoder_zeroing()</a>, <a class="el" href="foc_8c_source.html#l00033">foc_calibrate_phase()</a>, <a class="el" href="timer_8c_source.html#l00044">timer2_disable()</a>, and <a class="el" href="gd32f1x0__it_8c_source.html#l00104">TIMER2_IRQHandler()</a>.</p>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.4
</small></address>
</body>
</html>
